package Euler9;

public class PythagoreanTriplet {
	public static void main(String[] args) {
		int a,b,c,a2,b2,c2;
		
		for(c = 997; c>0; c--)
		{
			for(b = 1000-c; c>0; b--)
			{
				a = 1000-c-b;
				if(a>=b)
				{
					break;
				}
				else if(a==0)
				{
					continue;
				}
				
				a2 = (int) Math.pow(a, 2);
				b2 = (int) Math.pow(b, 2);
				c2 = (int) Math.pow(c, 2);
				
				if((a2 + b2) == c2)
				{
					System.out.println("a is: " + a + ", b is: " + b + ", c is:" + c + "\nThe product is: " + (a*b*c));
				}
			}
		}
	}
}
